<?php
if (!defined("__WD__")) exit("Wrong Connect");

class Model_Popup extends __Model {

	private $settings = null;
	public $css = null;
	public $js	= null;
	
	function __construct() {
		parent::__construct();
		$this->settings = array(
			"data" => "popup"
		);
		
		$this->css	= $this->data->library."/grp/admin/css/popup/init.css";
		$this->js	= $this->data->library."/grp/admin/js/popup/init.js";
	}

	function setDefault( $o ) {

		$this->settings = array_merge($this->settings, $o);
		
	}

	function usePopup() {

		$this->load->module("mysql", $this->db);

		$now = time();

		$storage = $this->settings['data'];

		$this->data->$storage = $this->db->fetch_assoc("select * from `wd_popup` where `fromdate` < ? and `todate` > ?", array($now, $now));

	}

}